package main

type TreeNode struct {
	val int
	left *TreeNode
	right *TreeNode
}

func main()  {

}

// 是否对称树
func isSymmetryTree(root *TreeNode) bool  {
	if root == nil {
		return true
	}
	return pisSymmetryTree(root.left, root.right)
}

func pisSymmetryTree(left *TreeNode, right *TreeNode) bool {
	if left == nil && right == nil {
		return true
	}

	if left == nil || right == nil || (left.val != right.val) {
		return false
	}

	return pisSymmetryTree(left.left,right.right) && pisSymmetryTree(left.right,right.left)
}